package com.apobates.jforum2.troll.regular.event;

import com.apobates.jforum2.troll.regular.ActionOperatorLog;
import com.apobates.jforum2.troll.regular.ForumActionEnum;
import com.google.gson.Gson;
import java.time.LocalDateTime;

/**
 * 会员操作日志
 * @author xiaofanku
 * @since 20210925
 */
public class MemberActionLog implements ActionOperatorLog {
    //会员
    private long memberId;
    private String memberNickname;
    private ForumActionEnum action;
    private String ipAddr;
    private String refererURL;
    private String device;
    private String token;
    //是否成功了,false(0)失败,true(1)成功
    private boolean success;
    //操作的日期
    private LocalDateTime dateTime;

    public MemberActionLog() {
    }

    public long getMemberId() {
        return memberId;
    }

    public String getMemberNickname() {
        return memberNickname;
    }

    public ForumActionEnum getAction() {
        return action;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public String getRefererURL() {
        return refererURL;
    }

    public String getDevice() {
        return device;
    }

    public String getToken() {
        return token;
    }

    public void setMemberId(long memberId) {
        this.memberId = memberId;
    }

    public void setMemberNickname(String memberNickname) {
        this.memberNickname = memberNickname;
    }

    public void setAction(ForumActionEnum action) {
        this.action = action;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public void setRefererURL(String refererURL) {
        this.refererURL = refererURL;
    }

    public void setDevice(String device) {
        this.device = device;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }

    public void setDateTime(LocalDateTime dateTime) {
        this.dateTime = dateTime;
    }
    @Override
    public String getPayload() {
        return new Gson().toJson(this);
    }

    @Override
    public String getBindingNames() {
        return "memberAction";
    }
}
